package easy;

import java.util.List;

public class Solution_1773 {

    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
        int index;
        if ("type".equals(ruleKey)) {
            index = 0;
        } else if ("color".equals(ruleKey)) {
            index = 1;
        } else {
            index = 2;
        }
        return (int) items.stream().map(list -> list.get(index)).filter(item -> ruleValue.equals(item)).count();
    }
}
